package org.example.hansp.collection_.exercise;

import java.sql.SQLOutput;
import java.util.*;

@SuppressWarnings({"all"})
public class HomeWork03 {
    public static void main(String[] args) {
        Map map=new HashMap();
        map.put("jack",650);
        map.put("tom",1200);
        map.put("smith",2900);

      /*  Set set=map.entrySet();
        Iterator iterator=set.iterator();
        while(iterator.hasNext()){
            Map.Entry entry=(Map.Entry)iterator.next();
            if(entry.getKey().equals("jack")){
                entry.setValue(2600);
            }
        }
        System.out.println(map);
        Iterator iterator1=set.iterator();
        while(iterator1.hasNext()){
            Map.Entry entry=(Map.Entry)iterator1.next();
            Integer value = (Integer) entry.getValue();
            entry.setValue(value+100);
        }
        System.out.println(map);
        Set set1=map.keySet();
        for (Object o : set1) {
            System.out.println(o+" "+map.get(o));
        }*/

        map.put("jack",2600);
        System.out.println(map);

        System.out.println("=====================");
        Set set=map.keySet();
        for (Object key : set) {
            map.put(key,(int)map.get(key)+100);
        }
        System.out.println(map);

        Set set1=map.entrySet();
        Iterator iterator=set1.iterator();
        while (iterator.hasNext()) {
            Map.Entry entry=(Map.Entry)iterator.next();
            System.out.println(entry.getKey()+":"+entry.getValue());
        }
        Collection values = map.values();
        for (Object value : values) {
            System.out.println("工资：    "+value);
        }
    }

}
